package org.millioncall.yueyoga.admin.service.impl;

import java.util.List;
import java.util.Map;

import org.millioncall.openplatform.common.PaginatedList;
import org.millioncall.yueyoga.admin.dao.PlaceDAO;
import org.millioncall.yueyoga.admin.model.Place;
import org.millioncall.yueyoga.admin.service.PlaceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PlaceServiceImpl implements PlaceService {
	private static final Logger logger = LoggerFactory.getLogger(PlaceService.class);
	private PlaceDAO placeDAO;

	public PlaceDAO getPlaceDAO() {
		return placeDAO;
	}

	public void setPlaceDAO(PlaceDAO placeDAO) {
		this.placeDAO = placeDAO;
	}

	@Override
	public int deleteByPrimaryKey(Integer id) {
		return this.placeDAO.deleteByPrimaryKey(id);
	}

	@Override
	public boolean insert(Place record) {
		int i=this.placeDAO.insert(record);
		if(i>0){
			return true;
		}else{
			return false;
		} 
	}

	@Override
	public int insertSelective(Place record) {
		return this.placeDAO.insertSelective(record);
	}

	@Override
	public Place selectByPrimaryKey(Integer id) {
		return this.placeDAO.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(Place record) {
		return this.placeDAO.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(Place record) {
		return this.placeDAO.updateByPrimaryKey(record);
	}

	@Override
	public List<Place> findAll(Map<String, Object> map) {
		return this.placeDAO.findAll(map);
	}

	@Override
	public Place findPlaceById(Integer id) {
		return this.placeDAO.findPlaceById(id);
	}

	@Override
	public PaginatedList<Place> getPlaseInPage(int start, int pageSize) {
		// TODO Auto-generated method stub
		return placeDAO.getPlaseInPage(start,pageSize);
	}

	@Override
	public void deletePlaseByIds(Integer[] deids) {
		if(deids == null || deids.length == 0) {
			logger.error("未提交要删除演讲者的编号");
			throw new RuntimeException(" 未提交要删除演讲者的编号");
		} else {
			placeDAO.deletePlaseByIds(deids);
		}
	}

	@Override
	public boolean updatePlace(Place place) {
		int i=this.placeDAO.updatePlace(place);
		if(i>0){
			return true;
		}else{
			return false;
		} 
	}

	@Override
	public PaginatedList<Place> getPlaseInPage(int start, int pageSize,
			Map<String, Object> map) {
		return placeDAO.getPlaseInPage(start,pageSize,map);
	}

	@Override
	public List<Place> findAllByOrganizationId(Map<String, Object> map) {
		return this.placeDAO.findAllByOrganizationId(map);
	}
}
